package com.itheima.exerciseTest.method10_19.method19;

import java.util.ArrayList;
import java.util.Scanner;

public class InfoManagerEntry {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        UserService us = new UserService();
        System.out.println("==========欢迎欢迎==========");
        while(true){
            System.out.println("1.注册 2.登录 3.退出");
            String select = sc.nextLine().trim();
            switch(select){
                case "1":
                    System.out.println("1.注册");
                    System.out.println("请输入用户名：");
                    String username = sc.nextLine().trim();
                    System.out.println("请输入密码：");
                    String password = sc.nextLine().trim();
                    boolean boo = us.userRegister(username,password);
                    if(!boo)
                        System.out.println("注册失败\n");
                    System.out.println("注册成功\n");
                    break;
                case "2":
                    System.out.println("2.登录");
                    System.out.println("请输入用户名：");
                    String username2 = sc.nextLine().trim();
                    System.out.println("请输入密码：");
                    String password2 = sc.nextLine().trim();
                    boolean boo2 = us.userLogin(username2,password2);
                    if(!boo2)
                        System.out.println("登录失败");
                    System.out.println("登录成功");
                    break;
                case "3":
                    System.out.println("拜拜了您嘞");
                    System.exit(0);
                    break;
                default:
                    System.out.println("输入有误，请重新输入：\n");
                    break;
            }
        }
    }
}
